<template>
  <div>
    <div class="block">
      <div class="block_title">C端域名配置</div>
      <div class="block_tip">提示：请将域名解析到cus.1688iot.vip；并在解析完十分钟后点击确定更新域名，同一域名每天只能更新3次。</div>
      <div class="block_form">
        <el-input v-model="value" style="width: 300px;"></el-input>
        <el-button type="primary" @click="next" style="margin: 0 20px">确定</el-button>
      </div>
    </div>

  </div>
</template>
<script>
import {getDomainHttp,updateDomainHttp} from '@/api/getData'
export default {
  data() {
    return {
      value: '',
    }
  },
  mounted() {
    this.initData();
  },
  methods: {
    async initData(){
      let resp = await getDomainHttp({dictType: "CUSTOMER"})
      this.value = resp.data?resp.data.hostname:'';
    },
    async next(){
      let res = await updateDomainHttp({
        dictType: 'CUSTOMER',
        hostname: this.value
      })
      if(res.code==10000){
        this.$message({
          type: 'success',
          message:'数据提交成功',
        })
      }
      else{
        this.$message.error('数据提交失败')
      }

    }
  }
}
</script>
<style scoped>
.block{
  width: auto;
  max-width: 700px;
  height: auto;
  position: relative;
  margin: 20px 20px;
  padding: 20px;
  border: 1px solid var(--lightBg);
  border-radius: 5px;
  background-repeat: no-repeat;
  background-size: cover;
  backdrop-filter: opacity(0.3);
}
.block_title{
  width: 100%;
  height: 30px;
  line-height: 30px;
  font-weight: bold;
  font-size: 18px;
  color: #555;
  text-indent: 20px;
}
.block_tip{
  width: 100%;
  height: auto;
  line-height: 20px;
  font-size: 14px;
  color: #999;
  text-indent: 10%;
  margin-top: 20px;
}
.block_form{
  width: 90%;
  height: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-left: 10%;
}
.row_form{
  width: 100%;
  height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
}
</style>
